package com.macro.mall;

import com.macro.mall.annotationUtil.CurrentUserHandlerMethodArgReslover;
import com.macro.mall.annotationUtil.CurrentUserModelHandlerMethodArgReslover;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
public class MvcConfig implements WebMvcConfigurer {

    @Bean
    public CurrentUserHandlerMethodArgReslover currentUserHandlerMethodArgReslover() {
        return new CurrentUserHandlerMethodArgReslover();
    }
    @Bean
    public CurrentUserModelHandlerMethodArgReslover currentUserModelHandlerMethodArgReslover() {
        return new CurrentUserModelHandlerMethodArgReslover();
    }
    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(currentUserHandlerMethodArgReslover());
        argumentResolvers.add(currentUserModelHandlerMethodArgReslover());
    }
}
